package com.zfzs.post.modules.common.repository;

import com.zfzs.post.modules.common.domain.AgentContact;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 代理商关系表
 * @author: ck
 * @create: 2019-08-20 15:09
 **/
@Repository
public interface AgentContactRepository extends JpaRepository<AgentContact,Long> {

    /**
     * 查询所有
     * @param agentId
     * @return
     */
    List<AgentContact> findByAgentIdAndChannelId(Long agentId,Long channelId);

    /**
     * 等级相关
     * @param agentId
     * @param level
     * @return
     */
    List<AgentContact> findByAgentIdAndChannelIdAndLevel(Long agentId,Long channelId,Integer level);

    /**
     * 等级不等
     * @param agentId
     * @param level
     * @return
     */
    List<AgentContact> findByAgentIdAndChannelIdAndLevelNot(Long agentId,Long channelId,Integer level);


    /**
     * 等级大于，用于查询合伙人
     * @param agentId
     * @param level
     * @return
     */
    List<AgentContact> findByAgentIdAndChannelIdAndLevelGreaterThan(Long agentId,Long channelId,Integer level);

    /**
     * 上级
     * @param childId
     * @return
     */
    List<AgentContact> findByChildIdAndChannelId(Long childId,Long channelId);

}
